/**
  * 获取查询参数
  * @param {string} code 查询代码
  * @param {number} size 每页条数
  * @param {Array} condition 查询条件
  * @param {Object} options 额外选项
  * @returns {Object} 查询参数
  */
export function getQueryParams(code, page = 0, size = 20, condition = [], options = {}) {
  const defaultParams = {
    filters: [],
    mobile: false,
    page: page,
    queryCode: code,
    schemaCode: code,
    size: size,
    queryVersion: 1,
    queryCondition: [[[...condition]]],
    showTotal: false
  };

  return { ...defaultParams, ...options };
}

/**
 * 获取字典类型数据
 * @param {string} code 查询代码
 * @param {number} size 每页条数
 * @param {Array} condition 查询条件
 */
export function getDictionaryParams(schemaCode, page = 0, size = 300, options = {}) {
  const defaultParams = {
    "queryCode": "",
    "schemaCode": schemaCode,
    "options": {
      "customDisplayColumns": [
        "lxmc"
      ]
    },
    "orderByFields": [
      "pxh"
    ],
    "orderType": 1,
    "page": page,
    "size": size,
    "filters": [],
    "condition": ""
  }
  return { ...defaultParams, ...options };
}
